package com.ostrich.cloud.ostrichUserWeb.app.ApiImp;

import cn.hutool.core.bean.BeanUtil;
import com.ostrich.cloud.common.result.Result;
import com.ostrich.cloud.ostrichUserService.client.CusLocationMangerClient;
import com.ostrich.cloud.ostrichUserWeb.client.CusWebLocationMangerClient;
import com.ostrich.cloud.ostrichUserWeb.client.userparam.CusLocationWebParam;
import com.ostrich.ostrichUserService.param.location.CusLocationParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.validation.Valid;

@RestController
public class CustomerWebLocationApiImp implements CusWebLocationMangerClient {
    @Resource
    private CusLocationMangerClient cusLocationMangerClient;
    @Override
    public Result uploadLocation( @Valid CusLocationWebParam cusLocationWebParam) {
        CusLocationParam cusLocationParam = BeanUtil.copyProperties(cusLocationWebParam, CusLocationParam.class);
        return cusLocationMangerClient.uploadLocation(cusLocationParam);
    }

    @Override
    public Result getAllLocations() {
        return cusLocationMangerClient.getAllLocations();
    }

    @Override
    public Result removeCusLocation(Integer locationId) {
        return cusLocationMangerClient.removeCusLocation(locationId);
    }

    @Override
    public Result putCusLocationState(Integer locationId, String status) {
        return cusLocationMangerClient.putCusLocationState(locationId, status);
    }
}
